<?php
/**
 * Created by PhpStorm.
 * User: lijie
 * Date: 2018/10/3
 * Time: 13:46
 */
namespace app\api\validate;

use think\Validate;

class Coupon extends Validate{

    protected $rule = [
        'id'                => ['require','number'],
        'c_id'            => ['require','number'],
        'u_id'              => ['require'],
        'redeemcode'              => ['require'],
        'coupon_id'            => ['require','number'],
        'title'             => ['require'],
        'desc'              => ['require'],
        'type'              => ['require'],
        'start_time'        => ['require'],
        'end_time'          => ['require'],
        'pagenum'           => ['require'],
        'listNum'           => ['require'],
        'status'            => ['require'],
    ];

    protected $message = [
        'id'                => 'id不能为空',
        'u_id'              => '未指定发放的用户',
        'c_id'              => '未指定商户',
        'redeemcode'        => '未指定优惠码',
        'coupon_id'         => '未指定修改主体',
        'title'             => '优惠券不能为空',
        'desc'              => '优惠券描述不能为空',
        'start_time'        => '优惠券开始不能为空',
        'end_time'          => '优惠券结束不能为空',
        'pagenum'           => 'pagenum不能为空',
        'listNum'           => 'listNum不能为空',
        'status'           => '状态不能为空！',

    ];

    protected $scene = [
        // 添加洗车门店产品
        'addCoupon'                => ['c_id','title','desc','type','start_time','end_time'],
        // 编辑洗车门店产品
        'editCoupon'               => ['coupon_id'],
        // 查看洗车门店产品
        'couponList'               => ['pagenum'],
        'couponLog'               => ['coupon_id','pagenum'],
        'addCouponToUser'          => ['redeemcode','u_id'],
        'getMyCoupon'              => ['u_id','status']
    ];
}